home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Game / R / ROBOT WARRIORS 1.0.1.CPT / Robot Warriors / Example Robots / Circle Shooter < prev    next >
Text File  |  1991-08-26  |  2KB  |  84 lines

  1. ;  Robot Name:  Circle Shooter
  2. ;
  3. ;  This robot simply moves around in a circle and tries to shoot anything
  4. ;  in it's path.  It scans in a circle very quickly using large radar increments
  5. ;  to catch robots that are close by quickly.  An improvement would be to lock
  6. ;  on to a robot if it is close enough.  This would be especially nice if since
  7. ;  the fire rate of this robot is high and we have no cloaking ability.
  8.  
  9.  
  10. CPU_SPEED 0
  11. ARMOR 2
  12. FIRE_RATE 3     ;Be able to shoot often
  13. ENGINE_SIZE 0
  14.    ;If in the middle of the battlefield then should be able to see most anywhere
  15.    ;with a radar range of 0.
  16. RADAR_RANGE 0
  17. CLOAKING 0
  18. FUEL_CAPACITY 1
  19.  
  20. define startangle 25
  21. allocate maxSpeed
  22.  
  23.     20 to maxSpeed
  24.  
  25.     gosub goto_middle               ;Move towards the middle before running circles
  26.     int_routine to time_int_xfer    ;Setup time interrupt routine
  27.     1 to time_int_mask
  28. again
  29.     gosub look_and_shoot
  30. goto again
  31.  
  32.  
  33. ;Look for a robot and shoot it if one found
  34. look_and_shoot
  35.     aim + 37 to aim  ;look around quickly to catch close robots.
  36.     aim to radar
  37.     if radar > 0 then 
  38.         if shot = 0 then  ;If can't shoot yet, then try to stay on enemy
  39.             radar to shot
  40.         else
  41.             aim - 37 to aim
  42.         end
  43.     end
  44.     if speed = 0 then
  45.         direction + 90 to direction  ;Try to move out of harms way
  46.         maxSpeed to speed
  47.     end
  48. return
  49.  
  50. goto_middle   ;Move to the center of the arena
  51.     if x > 190 then
  52.         270 to direction
  53.         while x > 185 do   ;In right half of arena, move left.
  54.             maxSpeed to speed
  55.             gosub look_and_shoot
  56.         end
  57.     else
  58.         90 to direction
  59.         while x < 195 do    ;In left half of arena, move right.
  60.             maxSpeed to speed
  61.             gosub look_and_shoot
  62.         end
  63.     end
  64.     if y < 146 then         ;Start a little up from center to start at the top of our circle
  65.         180 to direction
  66.         while y < 141 do    ;In top half of arena, move down.
  67.             maxSpeed to speed
  68.             gosub look_and_shoot
  69.         end
  70.     else
  71.         0 to direction
  72.         while y > 151 do    ;In bottom half of arena, move up
  73.             maxSpeed to speed
  74.             gosub look_and_shoot
  75.         end
  76.     end
  77.     90 to direction  ;Always start to the right
  78. return
  79.  
  80.  
  81.  
  82. int_routine
  83.     direction + 6 to direction  ;Every 1/10th of a second, turn right 6 degrees
  84. endint